﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using InPatientCntroller;

namespace HPMDesktop.Patient.Controls
{
    public partial class ProcudureDetailControl : UserControl
    {
        public ProcudureDetailControl()
        {
            InitializeComponent();
        }

        private void cmdCancel_Click(object sender, EventArgs e)
        {
            //this.Close();
        }

        private void cmdSave_Click(object sender, EventArgs e)
        {
            bool result;
            string CRNumber="AX101";
            PatientProcudureDetail objData = new PatientProcudureDetail();
            PatientProcudureDetail_Mapper objMapper = new PatientProcudureDetail_Mapper();

            try
            {
                objData.CRNumber = Convert.ToString(CRNumber);
                objData.ProcedureName = Convert.ToString(ProcedureName.Text);
                objData.ProcedureCode = Convert.ToString(ProcedureCode.Text);
                objData.ProcedureDate = ProcedureDate.Text;
                objData.ProcedureTime = Convert.ToString(ProcedureTime.Text);
                objData.Remarks = Convert.ToString(Remarks.Text);
                objData.Consultant = Convert.ToString(Consultant.Text);
                objData.ReportId = Convert.ToString(ReportId.Text);

                result = objMapper.Load_PatientProcudureDetail_DATA(objData.CRNumber , objData);
            }
            catch (Exception ex)
            {

            }
            finally
            {
                objData.Dispose();
                objMapper.Dispose();

            }

        }

        private void ProcudureDetailControl_Load(object sender, EventArgs e)
        {
            string CRNumber;
                CRNumber = "AX101";

                PatientProcudureDetail objData = new PatientProcudureDetail();
                PatientProcudureDetail_DataLoader objDataLoader = new PatientProcudureDetail_DataLoader();

                try
                {

                    objData = objDataLoader.Get_PatientProcudureDetail_DATA(CRNumber);

                    //CRNumber.Text = Convert.ToString(objData.CRNumber);
                    ProcedureName.Text = Convert.ToString(objData.ProcedureName);
                    ProcedureCode.Text = Convert.ToString(objData.ProcedureCode);
                    ProcedureDate.Text = Convert.ToString(objData.ProcedureDate);
                    ProcedureTime.Text = Convert.ToString(objData.ProcedureTime);
                    Remarks.Text = Convert.ToString(objData.Remarks);
                    Consultant.Text = Convert.ToString(objData.Consultant);
                    ReportId.Text = Convert.ToString(objData.ReportId);
                }
                catch (Exception ex)
                {

                }
                finally
                {
                    objData.Dispose();
                    objDataLoader.Dispose();

                }
            }

        }
    }

